<template>
	<view class="box-content-f" @click="itemClick">

	<!-- 	<view class="record-content">
			<view class="content">
					<span>类型</span>：{{formatContent()}}
			</view>
			<view class="time">
					<span>{{formatTimeName()}}</span>：{{formatTime()}}
			</view>

		</view> -->
		<view class="box-f-list">
						<view class="record-content">
							<view class="content">
									<span>类型</span>：{{formatContent()}}
							</view>
							<view class="time">
									<span>{{formatTimeName()}}</span>：{{formatTime()}}
							</view>
						</view>

			<LmageListView style="margin-top: 10rpx;"
				:resourceUrls="record.img | resourceUrlFilter" />
		</view>
		<view v-if="state">
			<div class="box-icon-f">
				<u-icon name="arrow-right"></u-icon>
			</div>
		</view>
	</view>
</template>

<script>
	import { formatDateByTimestamp } from '@/utils/utils.js'
	import LmageListView from '@/components/image-list-view.vue'
	export default {
		name: "Schedule",
		components: {
			LmageListView
		},
		props: {
			record: {
				type: Object,
				default () {
					return null;
				}
			},
			state: {
				type: Boolean,
				default: false
			}
		},
		filters: {
			resourceUrlFilter (value) {
				if (!value) {
					return []
				}
				return value.split('|');
			}
		},
		data() {
			return {
				time:'喂奶时间'
			};
		},
		methods:{
			formatTime() {
				console.log(this.record);
				// return `${this.record.begin}-${this.record.end}`
				return formatDateByTimestamp(this.record.eventTime, 'hh:MM');
			},
			formatTimeName() {
				return `${this.record.moreType * 1 ? '时间' : '喂奶时间'}`
			},
			
			formatContent() {
				return `${this.record.moreType * 1 ? '换尿布' : '喂奶'}`
			},
			
			itemClick() {
				this.$emit('itemClick')
			}
		}
	}
</script>

<style lang="scss">
	.box-content-f{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 20rpx 35rpx;
		background: #ffffff;
		line-height: 59rpx;
		padding: 20rpx 20rpx;
		border-bottom: 1rpx solid #F5F5F5;
	}
	
	.box-f-list {
		width: 100%;
		padding-left: 20rpx;
		padding-right: 20rpx;
		span {
			color: #999999;
		}

			

	}
	.box-icon-f{
		font-size: 30rpx;
	}
</style>
